#ifndef __NT35510_H__
#define __NT35510_H__

#include "stm32f4xx.h"
#include "string.h"

#define Bank1_SRAM3_ADDR         ((uint32_t)(0x6C000000))	
extern uint16_t LCD_X_LENGTH;
extern uint16_t LCD_Y_LENGTH;
// #define LCD_DATA_ADDR           ((uint32_t)(Bank1_SRAM3_ADDR |  (1<<(6+1))))
// #define LCD_DATA_CMD            ((uint32_t)(Bank1_SRAM3_ADDR &~ (1<<(6+1))))

#define ATK_MD0430_FSMC_REG_SEL (6)
#define LCD_DATA_CMD            (Bank1_SRAM3_ADDR | (((1U << ATK_MD0430_FSMC_REG_SEL) - 1) << 1))
#define LCD_DATA_ADDR           (Bank1_SRAM3_ADDR | ((1U << ATK_MD0430_FSMC_REG_SEL) << 1))


#define NT35510_HIGHT          800    //屏幕高度
#define NT35510_WIDTH          480    //屏幕宽度
#define SET_COLUMN_CMD         0x2A   //设置列命令
#define SET_ROW_CMD            0x2B   //设置行命令

#define SET_FONT_COLOR_POINT   BLACK   //设置选中的字体颜色
#define SET_FONT_COLOR_BACK    WHITE   //设置字体背景颜色
#define NT35510_X_Star		   0     //起始点的X坐标
#define NT35510_Y_Star		   0     //起始点的Y坐标

#define CMD_SetCoordinateX	   0x2A00	     //设置X坐标
#define CMD_SetCoordinateY	   0x2B00	     //设置Y坐标

/******************************* 定义 NT35510显示屏常用颜色 ********************************/
#define      BACKGROUND		               BLACK    //默认背景颜色
#define      WHITE		 		           0xFFFF	//白色
#define      BLACK                         0x0000	//黑色 
#define      GREY                          0xF7DE	//灰色 
#define      BLUE                          0x001F	//蓝色 
#define      BLUE2                         0x051F	//浅蓝色 
#define      BLUE3                         0x07FF   //浅蓝色2
#define      RED                           0xF800	//红色 
#define      MAGENTA                       0xF81F	//红紫色，洋红色 
#define      GREEN                         0x07E0	//绿色 
#define      CYAN                          0x7FFF	//蓝绿色，青色 
#define      YELLOW                        0xFFE0	//黄色 
#define      BRED                          0xF81F   //粉色


#define LCD_SCAN_MODE          0  //0 和 5   LCD扫描方向

void LCD_GPIO_Config(void);
void FSMC_Config(void);
void NT35510_Config_Init(void);
void lcd_init(void);
void LCD_WriteReg(uint16_t cmd, uint16_t data);
void NT35510_Write_Cmd(uint16_t cmd);
void NT35510_Write_Date(uint16_t data);
void LCD_Back_Light(uint8_t state);
void LCD_RST(void);
uint16_t LCD_Get_ID(void);
uint16_t LCD_Read_Data(void);
void Delay(__IO uint32_t nCount);
void LCD_Window(uint16_t x_start,uint16_t x_end,uint16_t y_start,uint16_t y_end);
void LCD_Color_Init(uint16_t x_start,uint16_t x_end,uint16_t y_start,uint16_t y_end,uint16_t color);
void NT35510_DisChar(uint16_t X, uint16_t Y, char cChar);
void Draw_Point(uint16_t x_start, uint16_t y_start, uint16_t size, uint16_t color);
void Draw_line(uint16_t x_start,uint16_t x_end,uint16_t y_start,uint16_t y_end, uint16_t color);
void NT35510_Scan_Directions(void);
//void Line_Size(uint16_t color);
void NT35510_DisString(uint16_t X, uint16_t Y, char *str);
void lv_LCD_Color_Init(uint16_t x_start,uint16_t x_end,uint16_t y_start,uint16_t y_end, uint16_t *color);

#endif  //__NT35510_H__
